/*
 * Page
 *
 * SJSU CS 149 Spring 2009 Project
 *
 * Copyright 2009 Timmy Yee
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * A Page object represents a page mapping, which is a three-item tuple
 * containing the logical page number, the physical frame number, and the
 * reference bit.
 *
 * @author Keven Wong
 * @author Miaoer Yu
 * @author Timmy Yee
 */
public class Page
{
    private final int pageNumber_;
    private final int frameNumber_;
    private boolean referenceBit_;

    /**
     * Constructs a page mapping.
     *
     * @param pageNumber    The logical page number.
     * @param frameNumber   The physical frame number.
     */
    public Page(int pageNumber, int frameNumber)
    {
        pageNumber_ = pageNumber;
        frameNumber_ = frameNumber;
        referenceBit_ = false;
    }

    /**
     * Gets the page number.
     *
     * @return The page number.
     */
    public int getPageNumber()
    {
        return pageNumber_;
    }

    /**
     * Gets the frame number.
     *
     * @return The frame number.
     */
    public int getFrameNumber()
    {
        return frameNumber_;
    }

    /**
     * Gets the value of the reference bit.
     *
     * @return The reference bit.
     */
    public boolean getReferenceBit()
    {
        return referenceBit_;
    }

    /**
     * Sets the new value of the reference bit.
     *
     * @param bit The new reference bit value.
     */
    public void setReferenceBit(boolean bit)
    {
        referenceBit_ = bit;
    }
}

